<script>

/*
	1. 存在问题
		- 正则表达式会直接变为{}
		- 时间会直接变为{}	
*/

function deepCopy(obj) {
	let res = {...obj};
	for(let key in obj) {
		if(!obj.hasOwnProperty(key)) continue;
		if(typeof(obj[key]) === 'object') {
			res[key] = deepCopy(obj[key]);
		}
	}
	return res;
}

let obj = {
	a: 1,
	b: {
		a: {
			a: 1,
		},
	},
	c: /^\d{11}$/,
	d: new Date(),
	e: function(){console.log('a')}
}

let res = deepCopy(obj);
console.log(res);
</script>